<template>
	<view class="container">
		<view class="page">
			<image v-if="!isLogin" class="wdl" src="/static/my_normal.png"></image>
			<image v-else class="head_icon" src="/static/head_icon.png" mode=""></image>
			<navigator class="username" v-if="!isLogin" url="./login">
				<button type="primary" size="mini" >用户登录</button>
			</navigator>
			<text v-else class="username">{{user.name}}</text>

		</view>
		<view style=" width: 100%;">
			<view class="entries">
				<view class="entry">
					<image class="entry_arrow" src="/static/UserInfo.png" style="width: 30px; height: 30px;"></image>
					<text class="entry_text">个人信息</text>
				</view>
				<view class="entry">
					<image class="entry_arrow" src="/static/purchaseorder.png" style="width: 30px; height: 30px;">
					</image>
					<text class="entry_text">订单列表</text>
				</view>
				<view class="entry">
					<image class="entry_arrow" src="/static/modify-password.png" style="width: 30px; height: 30px;">
					</image>
					<text class="entry_text">修改密码</text>
				</view>
				<view class="entry">
					<image class="entry_arrow" src="/static/yijianfankui.png" style="width: 30px; height: 30px;">
					</image>
					<text class="entry_text">意见反馈</text>
				</view>
			</view>
			<button type="primary" size="default" :disabled="!isLogin" style="width: 100%;" @click="logout">退出</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: {
					
				},
				isLogin:false
			}
		},
		onLoad() {

		},
		onShow(){
			this.isLogin=uni.getStorageSync('isLogin')
			this.user=uni.getStorageSync('user')
		},
		methods: {
			logout() {
				uni.setStorageSync('isLogin', false)
				this.isLogin = false
				uni.removeStorageSync('user')
			}
		}
	}
</script>

<style>
	.container {
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 100%;
		padding-top: 10%;
	}
	
	.page {

		height: 110px;
	}

	.wdl {
		height: 50px;
		width: 60px;
		margin-left: -37px;
		border-radius: 100%;
		position: absolute;
		top: 10%
	}

	.username {
		display: flex;
		margin-left: -50px;
		padding-top: 50px;
		position: absolute;
		top: 12%;
	}

	.entries {
		width: 90%;
		padding: 20px;
	}

	.entry_text {
		position: relative;
		right: -20px;
	}

	.entry {
		width: '90%';
		display: flex;
		flex-direction: row;
		align-items: center;
		height: 50px;
		/* justify-content: space-between; */
		border-top: 1px solid #CCC;

	}


	.entry:last-of-type {
		border-bottom: #CCC solid 1rpx;
	}

	.entry::after {
		content: '';
		background-image: url('../../static/more.png');
		position: absolute;
		width: 50rpx;
		height: 50rpx;
		margin-top: 0.5em;
		background-size: contain;
		right: 50rpx;
	}
</style>